import Vue from "vue";
import VueRouter from "vue-router";
// 解决重复进入一个路由报错问题
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

export default new VueRouter(
    {
        mode:'history',
        routes: [
            {
                path: '/',
                meta:{
                    keepAlive:false
                },
                component: () => { return import('./pages/Home') }
            },
            {
                path: '/myhome',
                meta:{
                    keepAlive:false
                },
                component: () => { return import('./pages/MyHome') }
            },
            {
                path: '/classify',
                meta:{
                    keepAlive:false
                },
                component: () => { return import('./pages/Classify') }
            },
            {
                path: '/myclassify',
                meta:{
                    keepAlive:false
                },
                component: () => { return import('./pages/MyClassify') }
            },
            {
                path: '/shopcar',
                meta:{
                    keepAlive:false
                },
                component: () => { return import('./pages/ShopCar') }
            },
            {
                path: '/myshopcar',
                meta:{
                    keepAlive:false
                },
                component: () => { return import('./pages/MyShopCar') }
            },
            {
                path: '/login',
                meta:{
                    keepAlive:true
                },
                component: () => { return import('./pages/Login') }
            },
            {
                path: '/my',
                meta:{
                    keepAlive:true
                },
                component: () => { return import('./pages/My') }
            },
            {
                path: '/detail',
                meta:{
                    keepAlive:false
                },
                component: () => { return import('./pages/Detail') }
            },
        ]
    }
)